class Code:
    """
    状态码，方便直接.出来
    """
    SUCCESS = (200, "成功")
    ARGS_ERROR = (400, "参数校验失败")
    NO_PERMISSION = (401, "没有操作权限")
    NO_LOGIN = (403, "用户未登录或登录已过期")
    OTHER_ERROR = (500, "其他错误")
    SERVER_BUSY = (999, "服务器繁忙")
    TAG_IS_NOT_EXIST = (501, "tag id 不存在")
    USER_TAG_ADD_FAILED = (501, "用户标签添加失败")
    USER_ID_VERIFY_FAILED = (501, "user id 不存在")


def response(_code=Code.SUCCESS, data=None, _msg=None):
    code, msg = _code

    if _msg is not None:
        msg = _msg

    return {"code": code, "msg": msg, "data": data}
